<?php
	////////////////////////////
	////Génération d'un PDF
	
	require('res/FPDF17/fpdf.php');
	require ('fonctions.php');
	// echo '<meta charset="UTF-8">';

	$classe = $_GET['classe'];
	// echo $phrase;

	$pdf = new FPDF();
	
	$header = Array('Nom','Prénom','login','mot de passe');
	
	$pdo_pdf = connexion_Table("beaufrene", "");
	$sql_pdf = 'SELECT * FROM Groupes, Eleves WHERE id_groupe="'.$classe.'" AND Groupes.libelle_csv_groupe=Eleves.libelle_classe_eleve';
	
	$req_pdf = $pdo_pdf->query($sql_pdf);

	$pdf->AddPage();
	$pdf->SetFont('Arial','B',14);
	
	// echo '<meta charset="UTF-8">';
	$result_pdf = $req_pdf->fetch();
	$pdf->Cell(40,10,'Classe : '.$result_pdf[1]);
	$pdf->Ln();
	$req_pdf->closeCursor();
	
	$pdf->Cell(40,10,$header[0], 1);
	$pdf->Cell(40,10,utf8_decode($header[1]), 1);
	$pdf->Cell(40,10,$header[2], 1);
	$pdf->Cell(40,10,$header[3], 1);
	$pdf->Ln();	
	
	$pdf->SetFont('Arial','',12);
	
	// echo "<p>Classe : ".$classe."</p>";
	
	$req_pdf = $pdo_pdf->query($sql_pdf);
		
	while ($result_pdf = $req_pdf->fetch()) { 
		
		$pdf->Cell(40,10,utf8_decode($result_pdf[5]), 1);
		$pdf->Cell(40,10,utf8_decode($result_pdf[6]), 1);
		$pdf->Cell(40,10,utf8_decode($result_pdf[10]), 1);
		$pdf->Cell(40,10,$result_pdf[9], 1);
		$pdf->Ln();
	}
	$pdf->Output();	
	

?>